<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>LAgain - 永恒的爱</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            color: #333;
        }
        
        .header {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            padding: 15px 0;
            box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
            position: sticky;
            top: 0;
            z-index: 100;
        }
        
        .header-content {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .logo {
            font-size: 24px;
            font-weight: 700;
            background: linear-gradient(135deg, #667eea, #764ba2);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        .user-info {
            display: flex;
            align-items: center;
            gap: 15px;
        }
        
        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
        }
        
        .logout-btn {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 14px;
        }
        
        .logout-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 40px 20px;
        }
        
        .hero-section {
            text-align: center;
            margin-bottom: 50px;
            color: white;
        }
        
        .hero-section h1 {
            font-size: 48px;
            font-weight: 700;
            margin-bottom: 20px;
            text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        }
        
        .hero-section p {
            font-size: 18px;
            opacity: 0.9;
            max-width: 600px;
            margin: 0 auto;
            line-height: 1.6;
        }
        
        .features-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 30px;
            margin-bottom: 50px;
        }
        
        .feature-card {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 20px;
            padding: 30px;
            text-align: center;
            transition: all 0.3s ease;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        }
        
        .feature-card:hover {
            transform: translateY(-10px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
        }
        
        .feature-icon {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 36px;
            margin: 0 auto 20px;
        }
        
        .feature-card h3 {
            font-size: 24px;
            margin-bottom: 15px;
            color: #333;
        }
        
        .feature-card p {
            color: #666;
            line-height: 1.6;
            margin-bottom: 20px;
        }
        
        .feature-btn {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 25px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-weight: 500;
        }
        
        .feature-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
        }
        
        .quick-actions {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 20px;
            padding: 30px;
            margin-bottom: 30px;
        }
        
        .quick-actions h2 {
            text-align: center;
            margin-bottom: 30px;
            color: #333;
            font-size: 28px;
        }
        
        .actions-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 20px;
        }
        
        .action-btn {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            border: none;
            padding: 20px;
            border-radius: 15px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 16px;
            font-weight: 500;
            text-align: center;
        }
        
        .action-btn:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
        }
        
        .alert {
            padding: 15px;
            border-radius: 10px;
            margin-bottom: 20px;
            font-size: 14px;
            display: none;
        }
        
        .alert.success {
            background: rgba(212, 237, 218, 0.9);
            color: #155724;
            border: 1px solid rgba(195, 230, 203, 0.9);
        }
        
        .alert.error {
            background: rgba(248, 215, 218, 0.9);
            color: #721c24;
            border: 1px solid rgba(245, 198, 203, 0.9);
        }
        
        .alert.info {
            background: rgba(209, 236, 241, 0.9);
            color: #0c5460;
            border: 1px solid rgba(190, 229, 235, 0.9);
        }
        
        @media (max-width: 768px) {
            .header-content {
                flex-direction: column;
                gap: 15px;
            }
            
            .hero-section h1 {
                font-size: 36px;
            }
            
            .features-grid {
                grid-template-columns: 1fr;
            }
            
            .actions-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }
        
        @media (max-width: 480px) {
            .actions-grid {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
    <div class="header">
        <div class="header-content">
            <div class="logo">LAgain</div>
            <div class="user-info">
                <div class="user-avatar" id="userAvatar">用</div>
                <div>
                    <div id="userName">用户</div>
                    <div style="font-size: 12px; color: #666;">普通用户</div>
                </div>
                <button class="logout-btn" onclick="logout()">退出登录</button>
            </div>
        </div>
    </div>
    
    <div class="container">
        <div id="alert" class="alert"></div>
        
        <div class="hero-section">
            <h1>欢迎来到 LAgain</h1>
            <p>记录美好时光，珍藏永恒回忆。在这里，每一个瞬间都值得被铭记，每一份情感都值得被珍藏。</p>
        </div>
        
        <div class="features-grid">
            <div class="feature-card">
                <div class="feature-icon">💝</div>
                <h3>时光胶囊</h3>
                <p>将珍贵的回忆封存在时光胶囊中，设定开启时间，给未来的自己一个惊喜。</p>
                <button class="feature-btn" onclick="openTimeCapsule()">创建胶囊</button>
            </div>
            
            <div class="feature-card">
                <div class="feature-icon">📝</div>
                <h3>心情日记</h3>
                <p>记录每天的心情变化，用文字和图片记录生活的点点滴滴。</p>
                <button class="feature-btn" onclick="writeDiary()">写日记</button>
            </div>
            
            <div class="feature-card">
                <div class="feature-icon">💌</div>
                <h3>情书传递</h3>
                <p>给心爱的人写一封情书，让爱意在文字间流淌。</p>
                <button class="feature-btn" onclick="writeLoveLetter()">写情书</button>
            </div>
        </div>
        
        <div class="quick-actions">
            <h2>快捷操作</h2>
            <div class="actions-grid">
                <button class="action-btn" onclick="viewProfile()">个人资料</button>
                <button class="action-btn" onclick="viewMemories()">我的回忆</button>
                <button class="action-btn" onclick="viewMessages()">消息中心</button>
                <button class="action-btn" onclick="viewSettings()">设置</button>
            </div>
        </div>
    </div>
    
    <script>
        // 检查登录状态
        function checkAuth() {
            const token = localStorage.getItem('token');
            if (!token) {
                window.location.href = '/login.html';
                return false;
            }
            return true;
        }
        
        // 显示提示信息
        function showAlert(message, type = 'info') {
            const alert = document.getElementById('alert');
            alert.textContent = message;
            alert.className = `alert ${type}`;
            alert.style.display = 'block';
            
            setTimeout(() => {
                alert.style.display = 'none';
            }, 3000);
        }
        
        // 退出登录
        function logout() {
            if (confirm('确定要退出登录吗？')) {
                localStorage.removeItem('token');
                localStorage.removeItem('user');
                localStorage.removeItem('role');
                localStorage.removeItem('roleName');
                window.location.href = '/login.html';
            }
        }
        
        // 加载用户信息
        function loadUserInfo() {
            const user = JSON.parse(localStorage.getItem('user') || '{}');
            
            if (user.nickname) {
                document.getElementById('userName').textContent = user.nickname;
                document.getElementById('userAvatar').textContent = user.nickname.charAt(0);
            }
        }
        
        // 功能按钮事件
        function openTimeCapsule() {
            showAlert('时光胶囊功能开发中，敬请期待...', 'info');
        }
        
        function writeDiary() {
            showAlert('心情日记功能开发中，敬请期待...', 'info');
        }
        
        function writeLoveLetter() {
            showAlert('情书传递功能开发中，敬请期待...', 'info');
        }
        
        function viewProfile() {
            showAlert('个人资料功能开发中，敬请期待...', 'info');
        }
        
        function viewMemories() {
            showAlert('我的回忆功能开发中，敬请期待...', 'info');
        }
        
        function viewMessages() {
            showAlert('消息中心功能开发中，敬请期待...', 'info');
        }
        
        function viewSettings() {
            showAlert('设置功能开发中，敬请期待...', 'info');
        }
        
        // 页面加载时执行
        window.addEventListener('load', function() {
            if (checkAuth()) {
                loadUserInfo();
                showAlert('欢迎回来！', 'success');
            }
        });
    </script>
</body>
</html>